home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
xinu.arc
/
CLKINT.MAC
next >
Wrap
Text File
|
1985-09-13
|
1KB
|
72 lines
;
; C L K I N T . M A C
;
; XINU Z80 Clock Interupt Routines
; Version 1.0 (Down and Dirty)
; S. R. Sampson, September 1985
;
; Do Xinu interupt processing.
;
clkint::
push h
push d
push b
push psw
lhld count50##
dcx h
shld count50##
mov a,h
ora l
jnz around ; Ignore first 50 interupts (50x.002=.1 Sec)
; Heathkit H89 has 2ms interupts
lxi h,50
shld count50##
lhld defclk## ; See if clock is deferred
mov a,h
ora l
jz notdef
lhld clkdiff##
inx h
shld clkdiff## ; Yes, so increment defer count
jmp around ; And return to system
notdef:
lhld slnempty## ; is sleep queue nonempty?
mov a,h
ora l
jz clpreem ; empty, go process preemption
lhld sltop## ; yes, decrement delta key
mov e,m
inx h
mov d,m
dcx d
mov a,d
ora e
mov m,d
dcx h
mov m,e
jnz clpreem
call wakeup## ; wakeup when sleep is done
clpreem:
lhld preempt## ; decrement preemption counter
dcx h
shld preempt##
mov a,h
ora l
jnz around
call resched## ; timeshare
around:
pop psw
pop b
pop d
pop h
ei
ret
end